const ProjectRequest = require("../project/project_request.js");
const Url = require("../utils/url.js");

function getStaffPage(startPage, callback) {
  const url = "/branchCompany/staff/page?startPage=" + startPage;
  ProjectRequest.getRequest(url, callback);
}

function getMoney(callback) {
  const url = "/branchCompany/staff/money/get";
  ProjectRequest.getRequest(url, callback);
}

/**
 * 提现
 */
function submitWithdrawOrder(amount, callback) {
  const url = "/branchCompany/staff/withdraw/submit";
  ProjectRequest.postRequest(url, { amount: amount }, callback);
}

/**
 * 提现列表
 */
function listWithdrawOrder(startPage, state, callback) {
  const url = Url
    .newInstance("/branchCompany/staff/withdraw/list")
    .setPara("startPage", startPage)
    .setPara("state", state);
  ProjectRequest.getRequest(url.get(), callback);
}

/**
 * 提现审核通过
 */
function withdrawVerifyPass(id, callback) {
  const url = "/branchCompany/staff/withdraw" + id + "/pass";
  ProjectRequest.getRequest(url, callback);
}

/**
 * 提现审核不通过
 */
function withdrawVerifyNoPass(id, callback) {
  const url = "/branchCompany/staff/withdraw" + id + "/nopass";
  ProjectRequest.postRequest(url, {}, callback);
}

/**
 * 提现待审核列表
 */
function withdrawVerifingPage(startPage, state, callback) {
  const url = Url
    .newInstance("/branchCompany/staff/withdraw/verify/list")
    .setPara("startPage", startPage)
    .setPara("state", state);
  ProjectRequest.getRequest(url.get(), callback);
}

/**
 * 金额记录列表
 */
function moneyRecoredPage(startPage, callback) {
  const url = "/branchCompany/staff/money/recored/page?startPage=" + startPage;
  ProjectRequest.getRequest(url, callback);
}

/**
 * exports
 */
module.exports = {
  getStaffPage,
  getMoney,
  submitWithdrawOrder, listWithdrawOrder,
  withdrawVerifyPass, withdrawVerifyNoPass, withdrawVerifingPage,
  moneyRecoredPage
};